﻿using System;
using System.Web.Mvc;
using Core.Extentions;
using System.Configuration;

namespace ScoutNET.Helpers
{
    public static class ImageResizerUrlHelper
    {
        public static string ImageResizedUrl(this HtmlHelper htmlHelper, string controllerName, string actionName, string imageTitle, Guid imageID)
        {
            return ImageResizedUrl(htmlHelper, controllerName, actionName, imageTitle, imageID.ToString());
        }

        public static string ImageResizedUrl(this HtmlHelper htmlHelper, string controllerName, string actionName, string imageTitle, int imageID)
        {
            return ImageResizedUrl(htmlHelper, controllerName, actionName, imageTitle, imageID.ToString());
        }

        private static string ImageResizedUrl(this HtmlHelper htmlHelper, string controllerName, string actionName, string imageTitle, string imageID)
        {
            string mediaUrl = ConfigurationManager.AppSettings["MediaUrl"];
            return string.Format("{0}{1}/{2}/{3}/{4}.jpg", mediaUrl, controllerName, actionName, imageTitle.ParseUrl(), imageID);
        }
    }
}
